Its a simple and powerfull script that can help you generate unique points within every Iranian states as much as you want. It contains a geojson file of Iran states boundaries downloaded from [www.Mapzen.com]
You can also see the map and the points graphically by using *[QGIS]. Note: QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). It runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities.
- Python 2.7
- python-pip
- python-geojson
- python-gdal
This guide is based on Python 2.7 on a Windows 32/64bit:
Install Python 2.7 with the default options and directories.
Download get-pip and run it through this command in command prompt Goto the directory that contains get-pip.py using cd commmand then type: 'python get-pip.py'
Now this is gonna be a little tricky. Follow the exact structions.
- Download the appropriate [GDAL Binary]. After downloading install GDAL with standard settings.
- Download [Python Bindings] for GDAL binaries and install them.
We need to tell Windows system where the GDAL installations are located, so we need to add some system variables.
- Right click on "Computer" on the desktop and go to "Properties"
- Click on Advanced System Properties
- Select Environment Variables.
- Under the System variables panel, find the ‘Path’ variable, then click on Edit.
- Go to the end of the box and copy and paste the following:
- ;C:\Program Files (x86)\GDAL
- Note: For 64-bit GDAL installations you would simply remove the (x86) after "Program Files" every time.
- In the same System variables pane, click on “New” and then add the following in the dialogue box:
- Variable name: GDAL_DATA
- Variable value: C:\Program Files (x86)\GDAL\gdal-data
- Click “OK”
- Add one more new variable by clicking “New…”
- Add the following in the dialogue box:
- Variable name: GDAL_DRIVER_PATH
- Variable value: C:\Program Files (x86)\GDAL\gdalplugins
- Click “OK”
- Open the Windows command line, by going to the Start Menu -> Run ->Type in cmd and press Enter.
- Type in gdalinfo –version
- Press Enter.
- If you get the following result, then congratulations your GDAL installation worked smoothly!
- GDAL 1.11.1, released 2014/09/24
Install these two packages using pip command also in cmd by typing:
pip install geojson
pip install gdal ( Just for sure )
Your Python Script is ready to use.
With special thanks to:
[Sepehrnoush] , [xunilk] [xunilk]: http://gis.stackexchange.com/users/45066/xunilk [Sepehrnoush]: https://github.com/sepehrnoush Source :
- [www.Mapzen.com]
- [www.GDAL.org]
- [py-gdalogr-cookbook] [www.Mapzen.com]: https://mapzen.com/ [py-gdalogr-cookbook]: https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html [www.GDAL.org]: http://www.gdal.org/classOGRGeometry.html#aa3d42b06ae6f7bbef6d1a2886da8d398 [Python Bindings]: http://download.gisinternals.com/sdk/downloads/release-1500-gdal-1-11-4-mapserver-6-4-3/GDAL-1.11.4.win32-py2.7.msi [GDAL Binary]: http://download.gisinternals.com/sdk/downloads/release-1500-gdal-1-11-4-mapserver-6-4-3/gdal-111-1500-core.msi