Tuesday, December 1, 2009

New CSV import interface

I know I should be writing a wrapup of Foss4G at Sydney and the the week afetr that GFOSS (the Italian local chapter), but coding is definitely more fun... uff

Well, at the last mixed uDig-JGrass-BeeGIS course we gave one recurring thing came out. People still use to have csv files and need to import them into GIS a LOT!!!
For those who do not know, CSV stands for comma separated values and is a text file that looks like:


So this morning I decided to add a new interface for that in JGrass. I hope it will be accepted quickly in uDig so that it goes into there.

How does it work now?

1) File -> Import and then choose CSV import

2) Browse for the file to import and choose the separator character/string.

The preview in the lower part helps you to see what is going on and also gives you the possibility to choose a type for the various fields, as well as the name. Remember that an X and an Y are mandatory.

3) Choose the coordinate system and push finish.

Nothing new obviously, but that was definitely missing in the uDig family.


J. Chris Jenson said...

I have been trying to use uDig, im a GIS newbie, and your post helped me find how to import a CSV. file. (thank you!) Is not mentioned at all in their walk-throughs so I would have never known.
However, now that I can import them, it seems I am using the wrong type of coordinates, or perhaps coordinate reference system? Any help with a solution would be much appreciated. I can see the coordinates in your post for the 3 Italian cities, when I get Lat and Long coordinates for Mezzolombardo I end up with these:
Lat: 46.210018
Long: 11.097815
Do I need to get a different type or coordinates? (What kind?) Or just use a different CRS? (Which one?) Any help would be much appreciated.

andrea antonello said...

Hi Chris, in which projection are you data? You can select in the wizard the projection you have the data in. In my example it is a UTM32N. Your data look like lat/long WGS84, which is the one taken by default if no projection is supplied. What is the problem with those? Can you just show a line of your csv, at least the part that shows your coordinates?

J. Chris Jenson said...

Hi Andrea! Thanks for posting a reply so quickly. I have tried several projections (including WGS84) to no avail. Here is three lines of my csv:

27.484599,-97.853953,Hunters Cove
32.4024852,-99.7985005,Quail Hollow

For some reason when I import them and use the WGS84 projection, they all appear in Antarctica? (They should be in the U.S.) This is the website I used to look up my coordinates: http://itouchmap.com/latlong.html

Thanks again for any help you can offer. =)

andrea antonello said...

Hi Chris, could it be that you are simply inverting lat with long? That would explain why you end up reeeeally south. Wish it is that easy, but worth a try :)

J. Chris Jenson said...

Your genius knows no bounds. Thank you Andrea, that's all it took. Now my map has dots all over Texas. Much appreciated.

andrea antonello said...

Glad it worked Chris :)
Good luck with your quest!

Anonymous said...

Thank you very much for such a helpful feature. Although i want to ask that, is it possible to input the wkt column rather than X and Y?
If it is, then please let me know how.
Actually I have seen such feature for QGIS so thought it might be available with uDig too.