Jamie,

Glad that worked. Ya, in I use ogr2ogr and ogrinfo frequently, so installing GDAL/OGR would be helpful for the kind of work you are doing.

However, Mapnik alone can do what ogrinfo does in terms of extents.

So, to demonstrate I just posted a python-mapnik equivalent to the summary mode of ogrinfo , called 'nikinfo.py'.

You can download it from: 
http://mapnik-utils.googlecode.com/svn/trunk/desktop/nikinfo/nikinfo.py

Here's an example of using it...
$ wget http://mapnik-utils.googlecode.com/svn/trunk/desktop/nikinfo/nikinfo.py
$ chmod +x nikinfo.py
$ ./nikinfo.py ../../sample_data/world_borders.shp
----------------------------------------------------------------------
Info for ../../sample_data/world_borders shapefile:
Envelope: Envelope(-180.0,-90.0,180.0,83.623596)
MaxX, MaxY, MinX, MinY: -180.0 -90.0 180.0 83.623596
Center: Coord(0.0,-3.188202)
Height: 173.623596
Width: 360.0
Attributes:
        type 1  name CAT        size 4
        type 4  name FIPS_CNTRY         size -1
        type 4  name CNTRY_NAME         size -1
        type 3  name AREA       size 8
        type 3  name POP_CNTRY  size 8

Sample XML layer:

  <Layer name="../../sample_data/world_borders" status="on">
    <StyleName>../../sample_data/world_borders_style</StyleName>
    <Datasource>
      <Parameter name="type">shape</Parameter>
<Parameter name="file">/Users/spring/projects/mapnik-utils/ trunk/sample_data/world_borders</Parameter>
    </Datasource>
  </Layer>

----------------------------------------------------------------------



Cheers,

Dane



On Oct 30, 2008, at 8:04 AM, Jamie Robertson wrote:

Thanks Dane! That did the trick, i didn't know about ogrinfo. That will make my life a lot easier.
-Jamie

On Mon, Oct 27, 2008 at 11:04 PM, Dane Springmeyer <[EMAIL PROTECTED]> wrote:
Hey Jamie,

I ran ogrinfo on your shapefile to get the extents in UTM and then plugged those in for the TileCache bbox and OpenLayers extents and the shapefile symbolized by Mapnik looks great.

See attached files with only slight modifications based on your testcase.

The main problem I noticed in your setup was on the OpenLayers side where you had not zoomed to UTM coordinates and were rather setting the map extent using lon/lat coordinates.

Dane




On Oct 27, 2008, at 12:06 PM, Jamie Robertson wrote:

Dane-

Attached are my files and the test shapefile i've been working with. These files when used with the standard EPSG: 4326 proj strings, omitting the last 4 lines of the tilecache .cfg, and the shapefile reprojected to GCS_WGS84, the tiles are rendered correctly.

When i replace the +proj strings, add the projection/extent info to the tilecache.cfg, and point to the UTM shapefile, nothing gets rendered—just the BG color.

thanks for looking at this!

-Jamie Robertson
On Mon, Oct 27, 2008 at 10:23 AM, Dane Springmeyer <[EMAIL PROTECTED] > wrote:
Jamie,

Could you post a test case. Ie create a zipped folder with your _full_ mapnik.xml, tilecache.cfg, and sample dataset in UTM?

Dane


On Oct 27, 2008, at 8:30 AM, Jamie Robertson wrote:

Thanks Chris, i tried adding the data-extent= and bbox= lines (like the googlecode example ) to the tilecache.cfg and am still getting the bg color tiles only.

Could this be a problem with proj4 not being configured properly on my machine?

here is my setup with a UTM12N configuration (shp data is already in the specified projection):
"mapfile.xml":
<?xml version="1.0" encoding="utf-8"?>
<Map srs="+proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" bgcolor="#4682b4">
    <Style name="base Style">
              /* STYLE STUFF */
    </Style>
<Layer name="base" srs="+proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" status="1" clear_label_cache="0">
        <StyleName>base Style</StyleName>
        <Datasource>
<Parameter name="file">/mapnik/data/basemap_UTM12N</ Parameter>
            <Parameter name="type">shape</Parameter>
        </Datasource>
    </Layer>
</Map>

what is the difference between setting the Map srs and the Layer srs? they should be the same, correct?

"tilecache.cfg":
[base]
type=Mapnik
mapfile=/mapnik/python/mapfile.xml
srs=EPSG:32612
projection= +proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 +units=m +no_defs
data_extent=258102.939, 299699.148, 258642.253, 300018.891
bbox=258102.939, 299699.148, 258642.253, 300018.891

openlayers js:
function init() {
    var lon = -113.983;
    var lat = 46.8609;
    var zoom = 17;
    OpenLayers.Feature.Vector.style['default'].cursor = 'pointer';
    var map = new OpenLayers.Map($('map'),
    {
controls: [ new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar() ],
        maxResolution: 360/512,
        projection: "EPSG:32612",
        numZoomLevels: 20,
        minZoomLevel: 17,
        maxZoomLevel: 20
    }

    );
-does anything except for the projection: "EPSG:32612", line need to be set here?

Thanks!
-jamie robertson

On Fri, Oct 24, 2008 at 2:45 PM, Christopher Schmidt <[EMAIL PROTECTED] > wrote:
On Fri, Oct 24, 2008 at 02:37:34PM -0600, Jamie Robertson wrote:
> - When i try this, the tiles (via tilecache.py) are rendered, but the > output is just the bg color, and none of the data is rendered. Do i need to > furthur specify the projection in the *tilecache.cfg* file? such as:

you don't need to specify the projection again, but you *do* need to
specify the resolution and extents of your data. (extents are a 4- tuple
seperated by commas, resolution is typically 'maxresolution=' with a
single value: often the equivilant of taking the maximum width of the
data and dividing by 512.)

To use with OpenLayers, you'll further need to ensure that these
settings match between OpenLayers and TileCache.

>
> [base]
> type=Mapnik
> mapfile=/mapnik/python/mapfile.xml
> srs=EPSG:102700
> projection= +proj=lcc +lat_1=45 +lat_2=49 +lat_0=44.25 +lon_0=-109.5
> +x_0=600000.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83
> +to_meter=0.3048006096012192 +no_defs
>
> - I've also tried this procedure with shapefile data that is already in
>    the UTM12N projection *EPSG: 32612* without success.
>
> Any ideas?
>
> Thanks!
>
> -Jamie Robertson

> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users


--
Christopher Schmidt
MetaCarta

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users


<mapnik_testcase.zip>




_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to