Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have access to a database here (description of the columns are also available) containing spatial data in text format and with WGS84-EPSG:4326 coordinates.

I would like to only select data in my country (Czech Republic) and save them to our database. Is there any easy way to do this without need to import it to spatial DB and then filter it out?

I am thinking about very simple calculation using simple conditions etc. Is there a better solution than to draw a rectangle in QGIS covering whole country and then use it to define range for longitude and latitude and use it as condition for filtering?

Thanks

share|improve this question
    
Just curious, what's stopping you from using a GIS or a spatial database btw? –  R.K. Sep 26 '12 at 12:43
    
R.K.: just because we need to simply and automatically download it and put in a CSV file using a simple script. GIS etc. will come later for data processing and analyses. –  Juhele Sep 26 '12 at 12:53
    
with php or python you can automatically download and create a csv file and put that in the [GIS]database. –  Mapperz Sep 26 '12 at 13:38
add comment

1 Answer

up vote 4 down vote accepted

On a simple level, if you define a bounding box for the Czech Republic you can construct an SQL query to test if the X and Y coordinates are within the maximum and minimum coordinates of the bounding box.

The query would be something like:

SELECT * FROM [TABLE] WHERE 
[X_FIELD] BETWEEN [BOUND_XMIN] AND [BOUND_XMAX] 
AND
[Y_FIELD] BETWEEN [BOUND_YMIN] AND [BOUND_YMAX]

Of course this will result in some data outwith the Czech Republic, as the country is not a perfect rectangle.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.