tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.11k stars 527 forks source link

Trouble adding >1 shapefiles #446

Closed ghost closed 13 years ago

ghost commented 13 years ago

Hello all,

First, sorry I am very new to programming, github and in general this whole domain/world! If I am clearly out of line somewhere, please let me know.

I am working with Toronto Open Data, http://www1.toronto.ca/wps/portal/open_data/open_data_list?vgnextoid=6e886aa8cc819210VgnVCM10000067d60f89RCRD centreline shapefile for the majority of my mapping. I need to bring in 3 more shapefiles that will be overlayed on top of the centreline data.

However, when trying to add each shapefile I am returned with an error in the terminal, as well as a corrupt map viewer (no tiles load at all when the new shapefile is loaded).

Here is one of the errors (although, each shapefile returns the same error "\'FCODE\'...etcetc:

{ message: 'Shape Plugin: error no attribute by the name of \'FCODE\', available attributes are: \'NUMBER\' \'RT_ROUTE\'' , stack: [Getter/Setter] } { message: 'Shape Plugin: error no attribute by the name of \'FCODE\', available attributes are: \'NUMBER\' \'RT_ROUTE\'' , stack: [Getter/Setter] } { message: 'Shape Plugin: error no attribute by the name of \'FCODE\', available attributes are: \'NUMBER\' \'RT_ROUTE\'' , stack: [Getter/Setter] } { message: 'Shape Plugin: error no attribute by the name of \'FCODE\', available attributes are: \'NUMBER\' \'RT_ROUTE\'' , stack: [Getter/Setter] } { message: 'Shape Plugin: error no attribute by the name of \'FCODE\', available attributes are: \'NUMBER\' \'RT_ROUTE\'' , stack: [Getter/Setter] }

and the style.mss

@lightblue: #0062ff; @coolwhite: #f2f6f7; @greenspace: #54a04b;

Map { background-color: @coolwhite }

/Railways/

tor_centreline[FCODE=202001],[FCODE=202002] {

line-color: darken(darkgray,30%);
line-width: .75;
line-dasharray: 3,3;

}

/Highways + Highway ramps/

tor_centreline[FCODE=201100],[FCODE=202101] {

line-width: 1.5;
line-color: lighten(red,15%);
line-opacity: .5;

}

/Major Roads/

tor_centreline[FCODE=201200],[FCODE=201201] {

line-width: 1;
line-color: darkgray;

}

/Minor Roads/

tor_centreline[FCODE=201300],[FCODE=201301] {

line-width: .75;
line-color: darken(gray,5%);

}

/Collector Roads/

tor_centreline[FCODE=201400],[FCODE=201401][zoom > 9] {

line-width: .5;
line-color: darken(gray,5%);

}

/Local Roads/

tor_centreline[FCODE=201500][zoom > 10] {

line-width: .25;
line-color: darken(gray,5%);

}

Thank you

springmeyer commented 13 years ago

Hi @markieta - great progress so far! So the issue is that your styles need to be sensitive to the attributes (named columns) of your data. So if your shapefile has columns with attributes named NUMBER and RT_ROUTE, then you need to put in your style only one of those values.

#tor_centreline[FCODE=201500] { ....}

The above does not work because FCODE is not an attribute present in your data.

springmeyer commented 13 years ago

Also, two other thoughts before I close this issue. One is that you can click on a layer (magnifying glass) to get a tabular view of available attributes. Also, Ideally Tilemill could do a better job giving you feeback that you need a style like:

#tor_centreline[RT_ROUTE=201500] { ....}

So, I've created an issue at Carto about how we could validate things to give you better errors in the application rather than just the terminal https://github.com/mapbox/carto/issues/76