Province Simplification
Home › Forums › Natural Earth Map Data › Cultural Vectors › Admin 1 – States, Provinces and their Boundaries › Province Simplification
- This topic has 2 replies, 1 voice, and was last updated 11 years, 8 months ago by WrinkledCheese.
-
AuthorPosts
-
March 26, 2013 at 10:07 am #4681
WrinkledCheeseParticipantHello all,
I’m working with natural earth data to try and create some overlays on a tile map using Leaflet + D3. I have noticed something interesting about the Admin_0 data vs the Admin_1 data. The Admin_1 data seems to be a mot more coarse than the Admin_0 data.
Am I doing something wrong?
Here is the command I’m using to get data:
ogr2ogr -wrapdateline -f “GeoJSON” -sql “SELECT iso_a2, adm1_code, mapcolor13 FROM ne_10m_admin_1_states_provinces_shp WHERE adm1_code = ‘[INSERT PROVINCE ADM1_CODE HERE]'” [INSERT PROVINCE ADM1_CODE HERE].json ../ne_10m_admin_1_states_provinces_shp.shp
At first I thought it was because I was using simplify, but that is not the case as I’ve removed it. Also, in actuality, I am running thousands of these scripts generated by a python script (below).
Attached is a screenshot of the ‘-hi’ resolution overlay. I am zoomed in to zoom level 7 with Nova Scotia, Canada highlighted. As you can see the resolution of the tile server is much higher. I don’t need that level of detail, but it seems the shortest line segment is about 20km/13mi.
import re
ogr2ogrProgramName = 'ogr2ogr'
ogr2ogrSimplifyOption001 = '-simplify 0.01'
ogr2ogrSimplifyOption005 = '-simplify 0.05'
ogr2ogrSimplifyOption01 = '-simplify 0.1'
ogr2ogrNonSqlOptions = '-wrapdateline -f "GeoJSON"'
ogr2ogrSqlOption = '-sql "SELECT iso_a2, adm1_code, mapcolor13 FROM ne_10m_admin_1_states_provinces_shp WHERE adm1_code = '
ogr2ogrString = ''prtFilename = '../rawdata/provinces.raw.txt'
matchType = type(re.match('abc', 'abc'))
prtRaw = open(prtFilename, 'r')
processScript = open('createProvinceJson.sh', 'w')
processScript.write('#!/bin/bash\n')for line in prtRaw:
#match: adm1_code (String) =
rePattern = '(\s\sadm1_code\s\(String\)\s\=\s)'
if type(re.search(rePattern, line)) == matchType:
adm1_code = re.sub(rePattern + '|(\n)', '', line)
#if(type(re.search('CAN-', adm1_code)) == matchType):
print adm1_code
#ogr2ogrString += ogr2ogrProgramName + ' ' + ogr2ogrNonSqlOptions + ' ' + ogr2ogrSqlOption + '\'' + adm1_code + '\'" ' + adm1_code + '.json ../ne_10m_admin_1_states_provinces_shp.shp;'
processScript.write(ogr2ogrProgramName + ' ' + ogr2ogrSimplifyOption001 + ' ' + ogr2ogrNonSqlOptions + ' ' + ogr2ogrSqlOption + '\'' + adm1_code + '\'" ' + adm1_code + '-hi.json ../ne_10m_admin_1_states_provinces_shp.shp;\n')
processScript.write(ogr2ogrProgramName + ' ' + ogr2ogrSimplifyOption005 + ' ' + ogr2ogrNonSqlOptions + ' ' + ogr2ogrSqlOption + '\'' + adm1_code + '\'" ' + adm1_code + '-md.json ../ne_10m_admin_1_states_provinces_shp.shp;\n')
processScript.write(ogr2ogrProgramName + ' ' + ogr2ogrNonSqlOptions + ' ' + ogr2ogrSqlOption + '\'' + adm1_code + '\'" ' + adm1_code + '-lo.json ../ne_10m_admin_1_states_provinces_shp.shp;\n')
print ogr2ogrProgramName + ' ' + ogr2ogrNonSqlOptions + ' ' + ogr2ogrSqlOption + '\'' + adm1_code + '\'" ' + adm1_code + '.json ../ne_10m_admin_1_states_provinces_shp.shp;\n'March 26, 2013 at 10:18 am #4683
WrinkledCheeseParticipantI suppose since Nova Scotia, Canada is fairly separate from other provinces and is quite large, the issue I’m seeing isn’t as noticeable.
Here is a picture of Switzerland at a similar zoom level 7.
March 26, 2013 at 10:21 am #4685
WrinkledCheeseParticipantNevermind, it has to do with the SVG scaling I’m doing with the overlay.
-
AuthorPosts
You must be logged in to reply to this topic.