Hi All,

Devdatta posted on another thread a python program he made for converting
even lines and polygons to .geojson format and it extracts the metadata too.
Link to conversation:
https://groups.google.com/d/msg/datameet/XTF4_P-nxU8/LS0_d85YBwAJ
Program link: https://github.com/devdattaT/GeoRSSConverter

Coincidentally I was also making something along the same lines over the
weekend and didn't notice the update there.
So here's another path up the mountain:
https://github.com/answerquest/georss2geojson-metadata-rescue

We've worked with different libraries, and I'm posting mine too for these
reasons:
- I've used a 'feedparser' module that does most of the grunt work of
converting the XML to geojson formatted objects. Which gave me time to:
- Used geojson and geojson_utils packages that can be taken forward for
programmatically doing GIS-type operations like merging separated parts
into multi-polygon (which is something mentioned about Bhuvan's data),
computing distance and area, detecting intersections etc
- Parsed the numbers in the metadata even if they're like: "-3.34e-4". So
the output .geojson shapefile has numeric fields if the metadata was
carrying it, one can directly use them to render choropleth etc. See a bad
example <https://i.imgur.com/Hyy53Zx.jpg>.
- Did a "right hand rule" rectification that was needed to produce valid
GeoJSON that checks out on geojsonlint.com . (not critical but some places
still need it)
- Save an additional CSV where the metadata is laid out in a neat table,
and if it's a point locations file, then the csv will have lat-long columns
and can be used directly for mapping, like I did with the asi-monuments
data previously <https://github.com/answerquest/asi-monuments-xml2csv>.

I've made it in a python 3 Jupyter Notebook <https://jupyter.org>; We could
make this into a user-friendly website or a EXE program that runs on
windows, but that will take some work. Contact if interested.


*Extra: *
1. Here's a site that makes embeddable choropleth maps without coding
needed, and can import the numbers from outside: https://app.datawrapper.de
(yes, QGIS can do it too, but single-task-focus brings user-friendliness)
2. And here are two sites that convert shapefiles between various formats:
http://ogre.adc4gis.com, https://geoconverter.hsr.ch/ (they don't rescue
the trapped metadata of course, that's peculiar to Bhuvan)


--
Cheers,
Nikhil VJ
+91-966-583-1250
Pune, India
http://nikhilvj.co.in


On Wed, Oct 17, 2018 at 10:57 AM Sashikumar N <[email protected]>
wrote:

> HI Nikhil,
> Cool and neat solution, Thankyou. just a quick question, what if the WMS
> layer is a line or polygon, what has to be changed in the python script?
>
> regards
> sashi
>
> On Wednesday, October 17, 2018 at 10:05:34 AM UTC+5:30, Nikhil VJ wrote:
>>
>> Here you go,
>>
>> https://github.com/answerquest/asi-monuments-xml2csv
>>
>> It's in a CSV now and you can drag-drop it on geojson.io for preview,
>> and convert it to other formats from there.
>>
>> All metadata encountered in the xml is saved in respective columns.
>>
>> The python script used is there too, in a jupyter notebook (.ipynb) file.
>> Github will display it nicely.
>>
>> -Nikhil VJ
>> Pune, India
>>
>>
>> On Tuesday, October 16, 2018 at 2:42:43 PM UTC+5:30, Arun Ganesh wrote:
>>>
>>> Found the Bhuvan geoserver listing which has the asi layers:
>>> http://bhuvan5.nrsc.gov.in/bhuvan/web/?wicket:bookmarkablePage=:org.geoserver.web.demo.MapPreviewPage
>>>
>>> They have disabled WFS so its not possible to download the shapefiles,
>>> but it looks the WMS GeoRSS output gives the vectors in an xml format.
>>>
>>> Monument locations:
>>> http://bhuvan5.nrsc.gov.in/bhuvan/asi/wms?service=WMS&version=1.1.0&request=GetMap&layers=asi:monuments2&styles=&bbox=68.963,8.076,96.005,32.976&width=512&height=471&srs=EPSG:4326&format=application%2Frss%2Bxml
>>>
>>> The file opens great in Qgis, but the feature properties are formatted
>>> as an HTML list. If this can be cleaned up, we can have the exact
>>> shapefiles.
>>>
>>> On Tue, Oct 16, 2018 at 12:59 PM Sashikumar N <[email protected]>
>>> wrote:
>>>
>>>> Scrapping WMS layer is not possible, (i don't know if there is a way to
>>>> do it). But if your interest is only few entities, you can use 'Tools' ->
>>>> 'Draw'  to mark/draw and download them as shapefile from the Bhuvan itself.
>>>>
>>>> On Monday, October 15, 2018 at 1:31:03 PM UTC+5:30, Arun Ganesh wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Oct 15, 2018 at 11:50 AM Sashikumar N <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Bhuvan has a WMS layer of all ASI monuments, please check
>>>>>>
>>>>>
>>>>> Thanks, found it here:
>>>>> https://bhuvan-app1.nrsc.gov.in/culture_monuments/
>>>>>
>>>>> Its fantastic to browse around and should be shared more widely. Is
>>>>> there a way to get the features as vectors?
>>>>>
>>>> --
>>>> Datameet is a community of Data Science enthusiasts in India. Know more
>>>> about us by visiting http://datameet.org
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "datameet" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
> Datameet is a community of Data Science enthusiasts in India. Know more
> about us by visiting http://datameet.org
> ---
> You received this message because you are subscribed to the Google Groups
> "datameet" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Datameet is a community of Data Science enthusiasts in India. Know more about 
us by visiting http://datameet.org
--- 
You received this message because you are subscribed to the Google Groups 
"datameet" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to