[gdal-dev] Enquiry

2014-03-19 Thread Tan Hao Feng
Dear Sir/Madam,

I'm a student in HSR, Rapperswil and I am trying to clip a SQLite file

I converted .osm.pbf file of liechtenstein to a .sqlite file, and then tried to 
clip it with the following codes, (is it -clipsrc or -clipdst

ogr2ogr -f SQLite liechtenstein.sqlite liechtenstein-latest.osm.pbg 
-skipfailures -dsco SPATIALITE=yes -clipsrc 47.1386361 9.5231616 47.1404971 
9.5266377


Also, I tried to clip the map of Singapore but was unsuccessful, the following 
is the code

ogr2ogr -f SQLite singapore.sqlite malaysia-singapore-brunei-latest.osm.pbg 
-skipfailures -dsco -clipsrc singapore.geojson

Do I have to convert to .shp file?

Do you have any suggestions?

Thank you!
Hao Feng.


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Enquiry

2014-03-19 Thread Chaitanya kumar CH
Hao,

The extents for -clipsrc have to be represented in the source's reference
system. You can use gdaltransform [1] if you want to convert your lat/long
to the source's ref system.

[1]: http://www.gdal.org/gdaltransform.html


On Wed, Mar 19, 2014 at 1:16 PM, Tan Hao Feng h...@hsr.ch wrote:

  Dear Sir/Madam,

 I'm a student in HSR, Rapperswil and I am trying to clip a SQLite file

 I converted .osm.pbf file of liechtenstein to a .sqlite file, and then
 tried to clip it with the following codes, (is it -clipsrc or -clipdst

 ogr2ogr -f SQLite liechtenstein.sqlite liechtenstein-latest.osm.pbg
 -skipfailures -dsco SPATIALITE=yes -clipsrc 47.1386361 9.5231616 47.1404971
 9.5266377


 Also, I tried to clip the map of Singapore but was unsuccessful, the
 following is the code

 ogr2ogr -f SQLite singapore.sqlite
 malaysia-singapore-brunei-latest.osm.pbg -skipfailures -dsco -clipsrc
 singapore.geojson

 Do I have to convert to .shp file?

 Do you have any suggestions?

 Thank you!
 Hao Feng.



 ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Enquiry

2014-03-19 Thread Jukka Rahkonen
Tan Hao Feng htan at hsr.ch writes:

 
 Dear Sir/Madam,
 
 I'm a student in HSR, Rapperswil and I am trying to clip a SQLite file
 I converted .osm.pbf file of liechtenstein to a .sqlite file, and then
tried to clip it with the following codes, (is it
 -clipsrc or -clipdstogr2ogr -f SQLite
 liechtenstein.sqlite
 liechtenstein-latest.osm.pbg -skipfailures -dsco SPATIALITE=yes -clipsrc
47.1386361 9.5231616 47.1404971
  9.5266377 Also, I tried to clip the map of Singapore but was
unsuccessful, the following is the code
 ogr2ogr -f SQLite singapore.sqlite
malaysia-singapore-brunei-latest.osm.pbg -skipfailures -dsco -clipsrc
singapore.geojson
 Do I have to convert to .shp file?
 Do you have any suggestions?
 Thank you!
 Hao Feng.

Hi,

I suggest to check the names of your input files. Are you sure they are .pbg
and not .pbf?

Clipsrc takes coordinates in the source projection, clipdst in target
projection. Both mean the same if you do not use different -s_srs and -t_srs
parameters. Did you not find the information from manual page
http://gdal.org/ogr2ogr.html? Read also the manual page of SQLite/Spatialite
format. I bet that you will want to create Spatialite database and not a
regular FDO database.

Here is a fast running query that worked for me:

ogr2ogr -f SQLite -dsco spatialite=yes clip.sqlite finland-latest.pbf 
-gt 2 -progress --config OGR_SQLITE_SYNCHRONOUS OFF 
--config OSM_COMPRESS_NODES YES -clipsrc 27 65 28 66 

-Jukka Rahkonen-


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Enquiry

2014-03-19 Thread Jukka Rahkonen
Hi,

It may not be a good idea to use -clipsrc with OpenStreetMap data at least
without some thinking. Clipping is cutting linestrings like highways which
intersect the clipping geometry into pieces and that is changing the
geometry type of clipped highway from linestring into multilinestring. Such
a highway cannot be stored into Spatialite table lines where it normally
belongs because of geometry type constraint. You can add -nlt
PROMOTE_TO_MULTI parameter into ogr2ogr but then all the highways will be
converted into multilinestrings. It may be OK for you to do so, but think
about that first.

Alternative way for clipping OSM data would be to use special tools like
Osmosis. I believe is has an option that selects the intersecting features
without cutting them into pieces.

-Jukka Rahkonen-

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev