Re: [MAPSERVER-USERS] Displaying population density with Mapserver
ALRIGHT !! It was a noob mistake indeed, I did not specify UNITS in the MAP object. In fact I thought Mapserver could know it from the shapefile. Thank you very much, it works fine now :) Faldor 2008/5/29 Fawcett, David <[EMAIL PROTECTED]>: > MapServer should do the conversion on the fly, my point was just that > MapServer needs to know what SRS (and units) that the data is in, so it can > make the translation. > > Can you post the text of your map file? > > David. > > -Original Message- > *From:* Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] > *Sent:* Thursday, May 29, 2008 2:51 AM > *To:* Fawcett, David > *Cc:* mapserver-users@lists.osgeo.org > *Subject:* Re: [MAPSERVER-USERS] Displaying population density with > Mapserver > > Hi David, > > I tried WGS84 yesterday after a little research on projection, but it > didn't change anything. > I tried re-generating the shapefile with WGS84 projection but it's still > the same. > In fact, my data comes from GPW v3 ( > http://sedac.ciesin.columbia.edu/gpw/global.jsp) but I didn't find any > clue on the projection used, I suppose there is none as you say. > > When you speak about translating ground units, do you mean I have to > translate my shapefile from degrees to, say, kilometers before I can use > SIZEUNITS kilometers ? I thought it could be done dynamically by MapServer. > I found a tutorial about this, I will try it anyway (assuming my data is > WGS84) and give you the outcome :) > > I attached my mapfile this time, just in case I made a noob mistake > somewhere... > > thank you very much ! > > Faldor > > 2008/5/28 Fawcett, David <[EMAIL PROTECTED]>: > >> Faldor, >> >> When you have point coordinates stored in a text file, there really is >> no way to encode/attach the projection definition. Even if you could, >> it doesn't sound like you really know what spatial reference system >> (SRS) or projection that it is in. The key to projecting to another SRS >> or translating ground units to another measure (from degrees to meters) >> is knowing what the current SRS of the data is. >> >> Since your data is worldwide and it is unprojected (lat/lon), a good >> first guess would be to assume that it is unprojected with using the >> WGS84. >> >> Try defining your layer projection by including this block in your layer >> definition. >> >> PROJECTION >> "init=epsg:4326" >> END >> >> David. >> >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of >> Pierre-Benoit Besse >> Sent: Wednesday, May 28, 2008 4:11 AM >> To: Fawcett, David >> Cc: mapserver-users@lists.osgeo.org >> Subject: Re: [MAPSERVER-USERS] Displaying population density with >> Mapserver >> >> >> Well, I confess, I'm new to GIS applications and I do not know a lot >> about projections. >> I understand I have to tell MapServer what is the projection of each >> layer I use in the mapfile, but using ogrinfo on my shapefiles tells me >> that : >> >> Layer name: pop_density >> Geometry: Point >> Feature Count: 249937 >> Extent: (-180.00, -56.00) - (179.75, 83.50) >> Layer SRS WKT: >> (unknown) >> latitude: Real (24.15) >> longitude: Real (24.15) >> densite: Real (24.15) >> >> I generated this shapefile from a CSV file with 3 columns : latitude, >> longitude, density_value. >> Did I have to define a projection then ? How do I do that ? >> >> Best regards, >> >> Faldor >> >> >> 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: >> >> Have you defined an output projection for your map and input projections >> for each of your layers? It is likely that MapServer needs to know what >> the input projection/SRS is before it can translate to different units. >> >> David. >> -Original Message- >> From: Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, May 27, 2008 11:26 AM >> To: Fawcett, David >> Cc: Ritesh Ambastha; mapserver-users@lists.osgeo.org >> Subject: Re: [MAPSERVER-USERS] Displaying population density with >> Mapserver >> >> >> Ha, well, I prefer that :) I would need a lot of layer definitions to >> obtain something ok... >> >> But I just tried the "ground units" stuff, I tried with a 50 kilometers >> wide square and it drew squares the size of ASIA !! oO >> I had to define a 1 feet wide square to obtain something more or less >> ok... >> Does any
RE: [MAPSERVER-USERS] Displaying population density with Mapserver
MapServer should do the conversion on the fly, my point was just that MapServer needs to know what SRS (and units) that the data is in, so it can make the translation. Can you post the text of your map file? David. -Original Message- From: Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2008 2:51 AM To: Fawcett, David Cc: mapserver-users@lists.osgeo.org Subject: Re: [MAPSERVER-USERS] Displaying population density with Mapserver Hi David, I tried WGS84 yesterday after a little research on projection, but it didn't change anything. I tried re-generating the shapefile with WGS84 projection but it's still the same. In fact, my data comes from GPW v3 (http://sedac.ciesin.columbia.edu/gpw/global.jsp) but I didn't find any clue on the projection used, I suppose there is none as you say. When you speak about translating ground units, do you mean I have to translate my shapefile from degrees to, say, kilometers before I can use SIZEUNITS kilometers ? I thought it could be done dynamically by MapServer. I found a tutorial about this, I will try it anyway (assuming my data is WGS84) and give you the outcome :) I attached my mapfile this time, just in case I made a noob mistake somewhere... thank you very much ! Faldor 2008/5/28 Fawcett, David <[EMAIL PROTECTED]>: Faldor, When you have point coordinates stored in a text file, there really is no way to encode/attach the projection definition. Even if you could, it doesn't sound like you really know what spatial reference system (SRS) or projection that it is in. The key to projecting to another SRS or translating ground units to another measure (from degrees to meters) is knowing what the current SRS of the data is. Since your data is worldwide and it is unprojected (lat/lon), a good first guess would be to assume that it is unprojected with using the WGS84. Try defining your layer projection by including this block in your layer definition. PROJECTION "init=epsg:4326" END David. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pierre-Benoit Besse Sent: Wednesday, May 28, 2008 4:11 AM To: Fawcett, David Cc: mapserver-users@lists.osgeo.org Subject: Re: [MAPSERVER-USERS] Displaying population density with Mapserver Well, I confess, I'm new to GIS applications and I do not know a lot about projections. I understand I have to tell MapServer what is the projection of each layer I use in the mapfile, but using ogrinfo on my shapefiles tells me that : Layer name: pop_density Geometry: Point Feature Count: 249937 Extent: (-180.00, -56.00) - (179.75, 83.50) Layer SRS WKT: (unknown) latitude: Real (24.15) longitude: Real (24.15) densite: Real (24.15) I generated this shapefile from a CSV file with 3 columns : latitude, longitude, density_value. Did I have to define a projection then ? How do I do that ? Best regards, Faldor 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: Have you defined an output projection for your map and input projections for each of your layers? It is likely that MapServer needs to know what the input projection/SRS is before it can translate to different units. David. -Original Message- From: Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2008 11:26 AM To: Fawcett, David Cc: Ritesh Ambastha; mapserver-users@lists.osgeo.org Subject: Re: [MAPSERVER-USERS] Displaying population density with Mapserver Ha, well, I prefer tha
Re: [MAPSERVER-USERS] Displaying population density with Mapserver
Hi David, I tried WGS84 yesterday after a little research on projection, but it didn't change anything. I tried re-generating the shapefile with WGS84 projection but it's still the same. In fact, my data comes from GPW v3 ( http://sedac.ciesin.columbia.edu/gpw/global.jsp) but I didn't find any clue on the projection used, I suppose there is none as you say. When you speak about translating ground units, do you mean I have to translate my shapefile from degrees to, say, kilometers before I can use SIZEUNITS kilometers ? I thought it could be done dynamically by MapServer. I found a tutorial about this, I will try it anyway (assuming my data is WGS84) and give you the outcome :) I attached my mapfile this time, just in case I made a noob mistake somewhere... thank you very much ! Faldor 2008/5/28 Fawcett, David <[EMAIL PROTECTED]>: > Faldor, > > When you have point coordinates stored in a text file, there really is > no way to encode/attach the projection definition. Even if you could, > it doesn't sound like you really know what spatial reference system > (SRS) or projection that it is in. The key to projecting to another SRS > or translating ground units to another measure (from degrees to meters) > is knowing what the current SRS of the data is. > > Since your data is worldwide and it is unprojected (lat/lon), a good > first guess would be to assume that it is unprojected with using the > WGS84. > > Try defining your layer projection by including this block in your layer > definition. > > PROJECTION > "init=epsg:4326" > END > > David. > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Pierre-Benoit Besse > Sent: Wednesday, May 28, 2008 4:11 AM > To: Fawcett, David > Cc: mapserver-users@lists.osgeo.org > Subject: Re: [MAPSERVER-USERS] Displaying population density with > Mapserver > > > Well, I confess, I'm new to GIS applications and I do not know a lot > about projections. > I understand I have to tell MapServer what is the projection of each > layer I use in the mapfile, but using ogrinfo on my shapefiles tells me > that : > > Layer name: pop_density > Geometry: Point > Feature Count: 249937 > Extent: (-180.00, -56.00) - (179.75, 83.50) > Layer SRS WKT: > (unknown) > latitude: Real (24.15) > longitude: Real (24.15) > densite: Real (24.15) > > I generated this shapefile from a CSV file with 3 columns : latitude, > longitude, density_value. > Did I have to define a projection then ? How do I do that ? > > Best regards, > > Faldor > > > 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: > > Have you defined an output projection for your map and input projections > for each of your layers? It is likely that MapServer needs to know what > the input projection/SRS is before it can translate to different units. > > David. > -Original Message- > From: Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 27, 2008 11:26 AM > To: Fawcett, David > Cc: Ritesh Ambastha; mapserver-users@lists.osgeo.org > Subject: Re: [MAPSERVER-USERS] Displaying population density with > Mapserver > > > Ha, well, I prefer that :) I would need a lot of layer definitions to > obtain something ok... > > But I just tried the "ground units" stuff, I tried with a 50 kilometers > wide square and it drew squares the size of ASIA !! oO > I had to define a 1 feet wide square to obtain something more or less > ok... > Does anybody know why ? > > Aside from that It seems to work, thank you ! > > I will try the scalesymbol stuff tomorrow. > > Regards > > > > 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: > > Before you create lots of different layers to simulate symbol scaling, > you may want to try something else. It has been a long time since I > have played with scaled symbols, but give it a try. > > You should be able to scale the symbols by setting a SYMBOLSCALE in the > LAYER object. This is the scale at which you want the symbol to appear > at the SIZE stated in the map file. > > You may want to modify STYLE MAXSIZE if you think that you will want > your symbols to be larger than 50 pixels. > > Another completely different approach that just came to my mind would be > to use ground units (e.g. meters) to set the size of your symbol. To do > this, set LAYER SIZEUNITS to meters. Calculate the size of a symbol in > meters on the ground that will touch adjacent symbols, or give you the > desired amount of space between the symbols. That way, the symbols > should scale consistently. > > David. > > > -Original Message- > From: [EMAIL P
RE: [MAPSERVER-USERS] Displaying population density with Mapserver
Faldor, When you have point coordinates stored in a text file, there really is no way to encode/attach the projection definition. Even if you could, it doesn't sound like you really know what spatial reference system (SRS) or projection that it is in. The key to projecting to another SRS or translating ground units to another measure (from degrees to meters) is knowing what the current SRS of the data is. Since your data is worldwide and it is unprojected (lat/lon), a good first guess would be to assume that it is unprojected with using the WGS84. Try defining your layer projection by including this block in your layer definition. PROJECTION "init=epsg:4326" END David. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pierre-Benoit Besse Sent: Wednesday, May 28, 2008 4:11 AM To: Fawcett, David Cc: mapserver-users@lists.osgeo.org Subject: Re: [MAPSERVER-USERS] Displaying population density with Mapserver Well, I confess, I'm new to GIS applications and I do not know a lot about projections. I understand I have to tell MapServer what is the projection of each layer I use in the mapfile, but using ogrinfo on my shapefiles tells me that : Layer name: pop_density Geometry: Point Feature Count: 249937 Extent: (-180.00, -56.00) - (179.75, 83.50) Layer SRS WKT: (unknown) latitude: Real (24.15) longitude: Real (24.15) densite: Real (24.15) I generated this shapefile from a CSV file with 3 columns : latitude, longitude, density_value. Did I have to define a projection then ? How do I do that ? Best regards, Faldor 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: Have you defined an output projection for your map and input projections for each of your layers? It is likely that MapServer needs to know what the input projection/SRS is before it can translate to different units. David. -Original Message- From: Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2008 11:26 AM To: Fawcett, David Cc: Ritesh Ambastha; mapserver-users@lists.osgeo.org Subject: Re: [MAPSERVER-USERS] Displaying population density with Mapserver Ha, well, I prefer that :) I would need a lot of layer definitions to obtain something ok... But I just tried the "ground units" stuff, I tried with a 50 kilometers wide square and it drew squares the size of ASIA !! oO I had to define a 1 feet wide square to obtain something more or less ok... Does anybody know why ? Aside from that It seems to work, thank you ! I will try the scalesymbol stuff tomorrow. Regards 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: Before you create lots of different layers to simulate symbol scaling, you may want to try something else. It has been a long time since I have played with scaled symbols, but give it a try. You should be able to scale the symbols by setting a SYMBOLSCALE in the LAYER object. This is the scale at which you want the symbol to appear at the SIZE stated in the map file. You may want to modify STYLE MAXSIZE if you think that you will want your symbols to be larger than 50 pixels. Another completely different approach that just came to my mind would be to use ground units (e.g. meters) to set the size of your symbol. To do this, set LAYER SIZEUNITS to meters. Calculate the size of a symbol in meters on the ground that will touch adjacent symbols, or give you the desired amount of space between the symbols. That way, the symbols should scale consistently. David. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ritesh Ambastha Sent: Tuesday, May 27, 2008 10:16 AM To: mapserver-users@lists.osgeo.org Subject: Re: [MAPSERVER-USERS] Displaying population density with Mapserver Dear Faldor, Robert is absolutely right. You will have to make different LAYERS for the same POINT layer. But, define MAX/MINSCALE for each Layer. Change STYLE -> SIZE values in each of the layer. You are done !! Cheers ! Ambastha Faldor wrote: > > Yes, but I need them to adapt for different extents. > > For example, When I zoom out enough to see the world, I need them 1 > pixel wide (it's ugly otherwise), but when I zoom in I will need then > 2 or 5 or even 30 pixels wide to cover all space. > > 2008/5/27 Ritesh Ambastha <[EMAIL PROTECTED]>: > >> >> Dear Faldor, >> >> What I need is to have the points grow to cover all space >> available when I zoom in. >> >> Do you mean that the size of points should grow? It can be done >> easily by setting proper SIZE in the STYLE tag. >> >> >> Regards, >> Ambastha >> >> >> >> Faldor wrote: >> > >> > Hi, >> > >> > Sorry for my first empty message. >> > >> > My problem is, I need to display population density with Mapserver. >> > The data
Re: [MAPSERVER-USERS] Displaying population density with Mapserver
Well, I confess, I'm new to GIS applications and I do not know a lot about projections. I understand I have to tell MapServer what is the projection of each layer I use in the mapfile, but using ogrinfo on my shapefiles tells me that : Layer name: pop_density Geometry: Point Feature Count: 249937 Extent: (-180.00, -56.00) - (179.75, 83.50) *Layer SRS WKT: (unknown)* latitude: Real (24.15) longitude: Real (24.15) densite: Real (24.15) I generated this shapefile from a CSV file with 3 columns : latitude, longitude, density_value. Did I have to define a projection then ? How do I do that ? Best regards, Faldor 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: > Have you defined an output projection for your map and input projections > for each of your layers? It is likely that MapServer needs to know what the > input projection/SRS is before it can translate to different units. > > David. > > -Original Message- > *From:* Pierre-Benoit Besse [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, May 27, 2008 11:26 AM > *To:* Fawcett, David > *Cc:* Ritesh Ambastha; mapserver-users@lists.osgeo.org > *Subject:* Re: [MAPSERVER-USERS] Displaying population density with > Mapserver > > Ha, well, I prefer that :) I would need a lot of layer definitions to > obtain something ok... > > But I just tried the "ground units" stuff, I tried with a 50 kilometers > wide square and it drew squares the size of ASIA !! oO > I had to define a 1 feet wide square to obtain something more or less ok... > Does anybody know why ? > > Aside from that It seems to work, thank you ! > > I will try the scalesymbol stuff tomorrow. > > Regards > > > 2008/5/27 Fawcett, David <[EMAIL PROTECTED]>: > >> Before you create lots of different layers to simulate symbol scaling, >> you may want to try something else. It has been a long time since I >> have played with scaled symbols, but give it a try. >> >> You should be able to scale the symbols by setting a SYMBOLSCALE in the >> LAYER object. This is the scale at which you want the symbol to appear >> at the SIZE stated in the map file. >> >> You may want to modify STYLE MAXSIZE if you think that you will want >> your symbols to be larger than 50 pixels. >> >> Another completely different approach that just came to my mind would be >> to use ground units (e.g. meters) to set the size of your symbol. To do >> this, set LAYER SIZEUNITS to meters. Calculate the size of a symbol in >> meters on the ground that will touch adjacent symbols, or give you the >> desired amount of space between the symbols. That way, the symbols >> should scale consistently. >> >> David. >> >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Ritesh >> Ambastha >> Sent: Tuesday, May 27, 2008 10:16 AM >> To: mapserver-users@lists.osgeo.org >> Subject: Re: [MAPSERVER-USERS] Displaying population density with >> Mapserver >> >> >> >> Dear Faldor, >> >> Robert is absolutely right. You will have to make different LAYERS for >> the same POINT layer. But, define MAX/MINSCALE for each Layer. Change >> STYLE -> SIZE values in each of the layer. You are done !! >> >> Cheers ! >> Ambastha >> >> >> Faldor wrote: >> > >> > Yes, but I need them to adapt for different extents. >> > >> > For example, When I zoom out enough to see the world, I need them 1 >> > pixel wide (it's ugly otherwise), but when I zoom in I will need then >> > 2 or 5 or even 30 pixels wide to cover all space. >> > >> > 2008/5/27 Ritesh Ambastha <[EMAIL PROTECTED]>: >> > >> >> >> >> Dear Faldor, >> >> >> >> What I need is to have the points grow to cover all space >> >> available when I zoom in. >> >> >> >> Do you mean that the size of points should grow? It can be done >> >> easily by setting proper SIZE in the STYLE tag. >> >> >> >> >> >> Regards, >> >> Ambastha >> >> >> >> >> >> >> >> Faldor wrote: >> >> > >> >> > Hi, >> >> > >> >> > Sorry for my first empty message. >> >> > >> >> > My problem is, I need to display population density with Mapserver. >> >> >> > The data comes from GPWv3 and has a resolution of 15'. I converted >> >> > it to a POINT Shapefile using ogr2ogr. >> >> > >> >> >