Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8727429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:26:01+00:00 2026-06-13T08:26:01+00:00

I try make a project to write data from .mif/.tab files to Data Base

  • 0

I try make a project to write data from .mif/.tab files to Data Base using GDAL/OGR. I do:

SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(dbFeatureType);
SimpleFeatureCollection collection = FeatureCollections.newCollection();
while (mifReader.hasNext()){      
  in = (SimpleFeatureImpl) mifReader.next();
  SimpleFeature dbFeature = featureBuilder.buildFeature(null);
  for(AttributeDescriptor ad : adList){
    String name = ad.getLocalName();
    Object attrValue;
    attrValue = in.getAttribute(name);
    if(attrValue instanceof String){
      String string3 = new String((attrValue.toString()).getBytes("ISO-8859-1"), "cp1251");
      if(name.trim().equalsIgnoreCase(kadname.trim())){
        dbFeature.setAttribute("kadnum", string3);
      }
    }
    if (attrValue instanceof Geometry){
        idn++;
        com.vividsolutions.jts.geom.Geometry geom = (Geometry) in.getAttribute(name);
        dbFeature.setAttribute("id", idn);
        System.out.println("after insrt="+idn);
        dbFeature.setAttribute("deleted", deleted);
        dbFeature.setAttribute("the_geom", geom);
        dbFeature.setAttribute("status_id", status_id);

    }
    collection.add(dbFeature);
    }
}

Its simple data from .mid file:

__id_|___kadnum_____

  3,"66:2:00:88 951"
  4,"66:2:00:88 952"
  5,"66:2:00:88 954"

And in db i get this:

enter image description here

My data is 2-4 rows. You see that i get increment variable idn and put it in attribute id. Take a kadnum from .mid and put it in attribute kadnum.
Its fine but in bd i get rows in the wrong order. I mean that element with attribute kadnum=66:2:00:88 951 gonna be in second row in db but it in 4th row.
Its mean that i gonna change the order of items in the collection to the opposite. Its right solvetion? And how to do this? Or GDAL can do it by self?

UPDATE

I have:

 SimplePropertyImpl in =(SimpleFeatureImpl) mifReader.next();

I try:

in.getProperty("id").getName() ;

And i dont get a PropertyName i get a String. What i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:26:02+00:00Added an answer on June 13, 2026 at 8:26 am

    Do you want to sort the database rows according to id?

    select * from <yourtable> order by id asc;
    

    If you want to sort your FeatureCollection in code, you may want to look into SimpleFeatureCollection.sort and SortBy. I would expect something like

    collection.sort( new SortBy() 
                     { 
                         @Override PropertyName getPropertyName() { return YourPropertyNameImpl( "id" ); } 
                         @Override SortOrder getSortOrder() { return SortOrder.ASCENDING; }
                     }
    

    would get you started in the right direction.

    Cheers,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i try to write a project to use Quart.net (http://quartznet.sourceforge.net/) to make job scheduling
I try to make Ext.Data.Store working... With a normal proxy it works great: var
I'm using the Fleximage plugin to manage image files in my rails project. This
I'm starting a project where I'm going to try to write a program for
I'm trying to write a basic account creation for an android project using PHP.
I'm trying to make a RESTful API with rails. When I try http://localhost:3000/api/v1/projects.json?token=kS8xi7YzaUDEmbmi9XL6 I
I try to make my ListBox connected to ObservaleCollection be more efficient so for
I try to make an ActiveX by C# with COM-visible. It is a Windows
I try to make an imageview clickable. Actually it is clickable, so that I
I try to make a table header fixed when scoll down on pages. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.