2

Hello:
I have the following:
1. Shapefile of the world with the boundaries of each country
-- Successfully imported shapefile into PostGIS database
-- Can display map of the world in a browser via Openlayers.

2 A data (CSV) file where each record has
a. birth country,
b. gender,
c. lat and long of the country of birth (which matches the lat & long in the shapefile)

I am trying to figure out the best approach to display a map where each country (based on the CSV data) that has a 100 or more people with a color say red or green....

So my question is:
If I create a separate table with the CSV data, is there a way link this table with the shapefile table to do the above?

OR

Do I need to merge the CSV data into the shapefile table in order to accomplish the above

I am using PostGIS, mapserver and Openlayers

Thanks
Chris

2

3 Answers 3

1

I would import data from CSV file to the same PostGIS database and then create a view on two tables that would have country name and number of people(calculated from data in CSV file).

Then I would create a WMS in Mapserver from this view with SLD where I specify which color every country gets depending on number of people.

2
  • Igorti: I see what you're saying.... It's a static set of data so I can use a table instead of a view.... I have a question about the shape file... I looked at the associated dbf file I don't see a geometry column. So how do I find the geometry for each country? Chris
    – ChrisJ
    Nov 21, 2010 at 23:22
  • one addition; Don't forget to add an entry to the VIEW in your geometry_columns table: postgis.refractions.net/documentation/manual-1.4/… Dec 16, 2010 at 7:19
0

You can import a Sharefile into geoserver and geoserver will provide a WMS resource that OpenLayers can read.

I am not too sure about how to integrate CSV data b/c it has been a while. Perhaps you can just make each country have its own DOM id and just alter CSS with different background-color after map is rendered using javascript.

1
  • Thanks for the suggestion... But I'm using mapserver on this project... Based on another suggestion, I'll import the CSV file as table and get at what I want via a SELECT statement that get data from both tables... Chris
    – ChrisJ
    Nov 19, 2010 at 13:40
0

@chris the .dbf file should have non-geographic data such as the data about birth country and gender.

Another good example is a Shapefile from US Census Bureau. Typically the dbf file will have Census data / demographic data; but not geographic data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.